package com.zoe.app.entity;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @author Zoe.Zhang
 * @date 2021/09/23
 * @description
 */
@Component
@ConfigurationProperties("user")
public class User {
    private String userName;
    private Integer age;
    private List<Car> cars;
    private String[] tags;
    private List<String> likes;
    private Map<String, String> maps;
    private static String weight;
    private Girlfriend girlFriend;

    public Girlfriend getGirlFriend() {
        return girlFriend;
    }

    public void setGirlFriend(Girlfriend girlFriend) {
        this.girlFriend = girlFriend;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        System.out.println("静态变量赋值set方法不能是静态的===>");
        User.weight = weight;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        System.out.println("userName===>" + userName);
        this.userName = userName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public List<Car> getCars() {
        return cars;
    }

    public void setCars(List<Car> cars) {
        this.cars = cars;
    }

    public String[] getTags() {
        return tags;
    }

    public void setTags(String[] tags) {
        this.tags = tags;
    }

    public List<String> getLikes() {
        return likes;
    }

    public void setLikes(List<String> likes) {
        this.likes = likes;
    }

    public Map<String, String> getMaps() {
        return maps;
    }

    public void setMaps(Map<String, String> maps) {
        this.maps = maps;
    }

    public static class Girlfriend {
        private String girlName;
        private Integer girlAge;

        public String getGirlName() {
            return girlName;
        }

        public void setGirlName(String girlName) {
            this.girlName = girlName;
        }

        public Integer getGirlAge() {
            return girlAge;
        }

        public void setGirlAge(Integer girlAge) {
            this.girlAge = girlAge;
        }

        @Override
        public String toString() {
            return "Girlfriend{" +
                    "girlName='" + girlName + '\'' +
                    ", girlAge=" + girlAge +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", age=" + age +
                ", cars=" + cars +
                ", tags=" + Arrays.toString(tags) +
                ", likes=" + likes +
                ", maps=" + maps +
                ", girlFriend=" + girlFriend +
                '}';
    }
}
